package com.dongwu.manager.entity;

import java.util.List;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;
import javax.persistence.ManyToMany;
import javax.persistence.ManyToOne;

import org.hibernate.annotations.Fetch;
import org.hibernate.annotations.FetchMode;

import com.dongwu.common.entity.BaseEntity;
import com.dongwu.security.entity.User;

/**
 * 广投墙文旅实体类
 * 
 * @author xyj
 *
 */
@Entity
public class Culture extends BaseEntity<String> {

	private String title; // 标题

	private String background; // 标题背景

	private String introduction; // 简介

	private type titleType; // 标题类型

	public enum type {
		max, min, med
	}

	@Column(columnDefinition = "Text")
	private String particulars; // 详情

	// private String stats; //状态

	@ManyToOne(cascade = { CascadeType.MERGE, CascadeType.REFRESH })
	@JoinColumn(name = "userid")
	private User user; // 用户

	@ManyToMany(cascade = { CascadeType.MERGE, CascadeType.REFRESH }, fetch = FetchType.LAZY)
	@JoinTable(name = "device_culture", joinColumns = { @JoinColumn(name = "cultureId") }, inverseJoinColumns = {
			@JoinColumn(name = "deviceId") })
	@Fetch(value = FetchMode.SUBSELECT)
	private List<Device> device; // 设备

	public String getTitle() {
		return title;
	}

	public void setTitle(String title) {
		this.title = title;
	}

	public String getBackground() {
		return background;
	}

	public void setBackground(String background) {
		this.background = background;
	}

	public String getIntroduction() {
		return introduction;
	}

	public void setIntroduction(String introduction) {
		this.introduction = introduction;
	}

	public String getParticulars() {
		return particulars;
	}

	public void setParticulars(String particulars) {
		this.particulars = particulars;
	}

	public User getUser() {
		return user;
	}

	public void setUser(User user) {
		this.user = user;
	}

	public List<Device> getDevice() {
		return device;
	}

	public void setDevice(List<Device> device) {
		this.device = device;
	}

	public type getTitleType() {
		return titleType;
	}

	public void setTitleType(type titleType) {
		this.titleType = titleType;
	}

}